<!--
 * @Descripttion: 详情弹框(查看、编辑、删除)
 * @version: v1.0.0
 * @Author: wang pingqi
 * @Date: 2021-04-19 15:47:59
 * @LastEditors: wang pingqi
 * @LastEditTime: 2022-05-06 16:28:46
-->
<template>
  <el-form
    ref="form0"
    :model="form"
    label-width="120px"
    label-position="right"
    class="form-wrapper"
    :disabled="status === 'r'"
  >
    <el-form-item label="所属酒店" prop="hotelId" verify>
      <el-select
        v-model="form.hotelId"
        placeholder="请选择"
        style="width: 100%"
        clearable
        filterable
      >
        <el-option
          v-for="item in hotelList"
          :key="item.hotelId"
          :label="item.hotelName"
          :value="item.hotelId"
        >
        </el-option>
      </el-select>
    </el-form-item>
    <el-form-item
      label="房型名称"
      prop="roomTypeName"
      :verify="{ minLength: 2 , maxLength: 20 }"
    >
      <el-input
        v-model="form.roomTypeName"
        maxlength="20"
        show-word-limit
        placeholder="请输入"
      >
      </el-input>
    </el-form-item>
    <el-form-item
      label="所在楼层"
      prop="floorRange"
      :verify="{ minLength: 1 , maxLength: 20 }"
    >
      <el-input
        v-model="form.floorRange"
        placeholder="可输入数字或字符。例如：2-4,6-8,15-20"
        maxlength="20"
        show-word-limit
      >
      </el-input>
    </el-form-item>
    <el-form-item label="房型种类" prop="standardRoomType" verify>
      <el-select
        v-model="form.standardRoomType"
        placeholder="请选择"
        style="width: 100%"
        clearable
      >
        <el-option
          v-for="item in dict.standard_room_type"
          :key="item.dataValue"
          :label="item.dataName"
          :value="item.dataValue"
        >
        </el-option>
      </el-select>
    </el-form-item>
    <el-form-item
      label="房型面积"
      prop="areaRange"
      :verify="{ type: 'int' , gte: 1 , lte: 999 }"
    >
      <el-input v-model.number="form.areaRange" placeholder="请输入整数">
      </el-input>
    </el-form-item>
    <el-form-item label="是否有窗" prop="windowFlag" verify>
      <el-select
        v-model="form.windowFlag"
        placeholder="请选择"
        style="width: 100%"
        clearable
      >
        <el-option
          v-for="item in [
            {
              dataName: '是',
              dataValue: 1,
            },
            {
              dataName: '否',
              dataValue: 0,
            },
          ]"
          :key="item.dataValue"
          :label="item.dataName"
          :value="item.dataValue"
        >
        </el-option>
      </el-select>
    </el-form-item>
    <el-form-item label="卫生间数量" prop="toiletNum" verify>
      <el-select
        v-model="form.toiletNum"
        placeholder="请选择"
        style="width: 100%"
        clearable
      >
        <el-option
          v-for="its in [0, 1, 2, 3, 4, 5, 6, 7, 8]"
          :key="its"
          :label="its"
          :value="its"
        >
        </el-option>
      </el-select>
    </el-form-item>
    <el-form-item label="最大入住人数" prop="capacity" verify>
      <el-select
        v-model="form.capacity"
        placeholder="请选择"
        style="width: 100%"
        clearable
      >
        <el-option
          v-for="its in [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]"
          :key="its"
          :label="its"
          :value="its"
        >
        </el-option>
      </el-select>
    </el-form-item>
    <el-form-item label="房型特色描述" prop="info">
      <el-input v-model="form.info" maxlength="20" placeholder="请输入" show-word-limit> </el-input>
    </el-form-item>
    <el-form-item label="房型标签" prop="tags">
      <dynamic-tag v-model="form.tags" :count="4" :maxlength="6" />
    </el-form-item>
  </el-form>
</template>

<script>
import { mapGetters } from "vuex";
import { DynamicTag } from 'dynamic-tag'

export default {
  components: { DynamicTag },
  props: {
    form: {
      type: Object,
      required: true,
      default() {
        return {};
      },
    },
    status: {
      type: String,
      required: true,
    },
    hotelList: {
      type: Array,
      required: true,
    },
  },
  computed: {
    ...mapGetters(["dict"]),
  }
};
</script>

<style lang="scss" scoped>
</style>